import { Module } from '@nestjs/common';
import { AdminController } from './admin.controller';
import { AdminService } from './admin.service';
import { ConfigureModule, ConfigureService } from '@app/configure';

import config from './config';
import { MemberModule } from './http/system/member/member.module';
import { DbModule } from './db/db.module';
import { CacheModule } from '@app/cache';
import { LoginModule } from './http/system/login/login.module';
import { ResponseUtilModule } from '@app/response-util';
import { MenuModule } from './http/system/menu/menu.module';
import { RoleModule } from './http/system/role/role.module';
import { AuthGuard } from './guard/auth/auth.guard';
import { APP_GUARD } from '@nestjs/core';
import { JwtVerifyModule } from '@app/jwt-verify';
import { DictionaryCategoryModule } from './http/system/dictionary-category/dictionary-category.module';
import { DictionaryItemModule } from './http/system/dictionary-item/dictionary-item.module';
import { MerchantModule } from './http/merchant/merchant.module';
import { DeviceTypeModule } from './http/device-type/device-type.module';
import { DeviceModule } from './http/device/device.module';
import { DeviceParamsFieldModule } from './http/device-params-field/device-params-field.module';
import { DeviceParamsModule } from './http/device-params/device-params.module';
import { AlicloudModule } from '@app/alicloud';
import { SysConfigModule } from './http/system/sys-config/sys-config.module';;
import { OptionModule } from './http/recharge/option/option.module';
import { OrderModule } from './http/recharge/order/order.module';
import { WaterBillsModule } from './http/water-bills/water-bills.module';
import { WaterTestModule } from './http/water-test/water-test.module';
import { UserModule } from './http/user/user.module';
import { UploadModule } from './http/upload/upload.module';

@Module({
	imports: [
        JwtVerifyModule,
		ConfigureModule.forRoot(config),
        CacheModule,
		DbModule,
		AlicloudModule.forRootAsync({
			imports : [ConfigureModule],
			inject : [ConfigureService],
			useFactory : (config:ConfigureService) => {
				return {
					...config.get('alicloud')
				}
			},
		}),

        ResponseUtilModule,
		MemberModule,
		LoginModule,
		MenuModule,
		RoleModule,
		DictionaryCategoryModule,
		DictionaryItemModule,
		MerchantModule,
		DeviceTypeModule,
		DeviceModule,
		DeviceParamsFieldModule,
		DeviceParamsModule,
		SysConfigModule,
		OptionModule,
		OrderModule,
		WaterBillsModule,
		WaterTestModule,
		UserModule,
		UploadModule,
	],
	controllers: [AdminController],
	providers: [AdminService, {provide : APP_GUARD, useClass : AuthGuard}],
})
export class AdminModule {}
